
import { getToken, getUuid } from '@/utils/auth'

const user = {
  state: {
    token: getToken(),
    name: '',
    bgItem: '',
    id: 0,
    userName: '',
    trueName: '',
    mobile: '',
    detailAddress: '',
    qq: '',
    email: '',
    wechat: '',
    skin: '',
    uuid: getUuid()
  },

  mutations: {
    SET_TOKEN: (state, token) => {
      state.token = token
      sessionStorage.token = token
    },
    SET_NAME: (state, name) => {
      state.name = name
    },
    SET_BGITEM: (state, item) => {
      state.bgItem = item
    },
    SET_ID: (state, id) => {
      state.id = id
    },
    SET_USERNAME: (state, userName) => {
      state.userName = userName
    },
    SET_TRUENAME: (state, trueName) => {
      state.trueName = trueName
    },
    SET_MOBILE: (state, mobile) => {
      state.mobile = mobile
    },
    SET_DETAILADDRESS: (state, detailAddress) => {
      state.detailAddress = detailAddress
    },
    SET_QQ: (state, qq) => {
      state.qq = qq
    },
    SET_EMAIL: (state, email) => {
      state.email = email
    },
    SET_WECHAT: (state, wechat) => {
      state.wechat = wechat
    },
    SET_SKIN: (state, skin) => {
      state.skin = skin
    },
    SET_UUID: (state, uuid) => {
      state.uuid = uuid
    }
  }
}

export default user
